package com.tanhua.dubbo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.domain.vo.InfoVo;
import com.tanhua.domain.vo.UserInfoVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.web.bind.annotation.DeleteMapping;

public interface BlackMapper extends BaseMapper {

    /**
     * 查看黑名单列表
     * @param
     * @param
     * @return
     */
    @Select("SELECT info.id,info.avatar,info.nickname,info.gender,info.age FROM tb_user_info info,\n" +
            "tb_black_list bl\n" +
            "WHERE info.id=bl.`black_user_id` AND bl.`user_id`=#{userId}")
    Page<InfoVo> findPage(Page iPage, @Param("userId") Long userId);

    /**
     * 移除黑名单
     */
    @Delete("delete from tb_black_list where user_id=#{userId} and black_user_id=#{uid}")
    void del(@Param("userId") Long userId, @Param("uid")Long uid);

}
